package com.ftg.learn.student.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author kangjx
 * @createTime 2022/8/1
 */
public class StudentProvoder {


    /**
     * sql构建器
     * @param id 主键
     * @return
     */
    public String createFindId2(@Param("id") String id) {
        SQL sql =  new SQL();
        sql.SELECT("sno,sname,sage,ssex").FROM("student");
        if(id!= null){
            sql.WHERE("sno =#{id}");
        }
        return sql.toString();
    }

//    public String createFindId2(@Param("id") String id) {
//        return "select * from student where sno = #{id}";
//    }

//    public String createFindId2(@Param("id") String id) {
//        String sql = "select * from student where 1=1 ";
//        if(id != null && !id.equals("")){
//            sql += " AND sno = #{id}";
//        }
//        return sql;
//    }


}
